package com.hex.ds.hdrs.period.job.converter;

import com.hex.ds.hdrs.common.utils.BaseUtil;
import com.hex.ds.hdrs.common.utils.HdrsDateUtil;
import com.hex.ds.hdrs.period.job.dto.PeriodJobDto;
import com.hex.ds.hdrs.period.job.po.PeriodJob;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring", imports = {BaseUtil.class, HdrsDateUtil.class})
public interface IPeriodJobConverter {

    PeriodJob toPeriodJob(PeriodJobDto periodJobDto);

    @Mapping(target = "pkId", expression = "java(BaseUtil.getPkId())")
    @Mapping(target = "crtTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "upTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "upUser", expression = "java(BaseUtil.getUserId())")
    @Mapping(target = "jobStatus", source = "jobStatus")
    @Mapping(target = "bizDate", source = "bizDate")
    PeriodJob copyPeriodJob(PeriodJob periodJob, String jobStatus, String bizDate);

}
